#include "sort.h"
#include "str.h"

void bubbleSort(char** words, int arraySize)
{
    int i = 0, j = 0;
    int cmp = 0;

    int hasToSwap = 1;

    for (i = (arraySize - 1); i > 0 && hasToSwap; i--)
    {
    	hasToSwap = 0;
        for (j = 1; j <= i; j++)
        {
        	cmp = strcasecmp(words[j - 1], words[j]);
            if (cmp > 0)
            {
            	hasToSwap = 1;
                swap(&words[j - 1], &words[j]);
            }
        }
    }
}
